﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OutDemoP18_7 {
    internal class Program {
        static void Main(string[] args) {
            //这里默认值是 0 
            double result;
            bool b =  DoubleParser.TryParse("abs", out result);
            Console.WriteLine("{0}===={1}",b,result);
            Console.ReadLine();
        }
    }

    class DoubleParser {
        /**
         * 在方法体中，输出参数必须要赋值
         */
        public static bool TryParse(string input, out double result) {
            try {
                result = double.Parse(input);
                return true;
            } catch (Exception e) {
                result = 0;
                return false;
            }
        }
    }
}
